package service

type PlayService struct {
}

func (b *PlayService) Play() error {
	//var AnsiblePlayBookFile string
	//s := global.Config.System
	//if !filepath.IsAbs(s.PlayBookFile) {
	//	currentDir, _ := os.Getwd()
	//	parentDir := filepath.Dir(currentDir)
	//	AnsiblePlayBookFile = parentDir + "/" + s.PlayBookFile
	//} else {
	//	AnsiblePlayBookFile = s.PlayBookFile
	//}
	//
	//playbookCmd := &playbook.AnsiblePlaybookCmd{
	//	Playbooks: []string{AnsiblePlayBookFile},
	//	Options:   GetOps(),
	//}
	//err := playbookCmd.Run(context.TODO())
	//if err != nil {
	//	return err
	//}
	//return nil
	return nil
}

//func GetOps() *playbook.AnsiblePlaybookOptions {
//	var AnsibleHostFile string
//	s := global.Config.System
//	if !filepath.IsAbs(s.HostFile) {
//		// 获取父目录
//		currentDir, _ := os.Getwd()
//		parentDir := filepath.Dir(currentDir)
//		AnsibleHostFile = parentDir + "/" + s.HostFile
//		//playBookFile := parentDir + s.PlayBookFile
//	} else {
//		AnsibleHostFile = s.HostFile
//	}
//	ansiblePlaybookOptions := &playbook.AnsiblePlaybookOptions{
//		Inventory: AnsibleHostFile,
//	}
//	return ansiblePlaybookOptions
//}
